﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	x:Class="Microsoft.Research.ScientificWorkflow.UIDesigner.PropertiesPane"
	x:Name="PropertiesPanePopUp" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:templateSelectorNs="clr-namespace:Microsoft.Research.ScientificWorkflow.UIDesigner"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
    <UserControl.Resources>
        <Style x:Key="TreeViewFocusVisual">
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border BorderThickness="3" BorderBrush="#FF9DC4D8"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="PopupCloseButton" BasedOn="{x:Null}" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Rectangle Fill="#FFCCCCCC" Stroke="{x:Null}" RadiusX="4.5" RadiusY="4.5" x:Name="rectangle"/>
                            <Rectangle Fill="#FF4F4F4F" Stroke="{x:Null}" RadiusX="0" RadiusY="0" Margin="8,3.5,7,3.5" RenderTransformOrigin="0.5,0.5">
                                <Rectangle.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="-34.039"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Rectangle.RenderTransform>
                            </Rectangle>
                            <Rectangle Fill="#FF4F4F4F" Stroke="{x:Null}" RadiusX="0" RadiusY="0" RenderTransformOrigin="0.5,0.5" Margin="8,3.5,7,3.5">
                                <Rectangle.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="-1" ScaleY="1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="34.039"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Rectangle.RenderTransform>
                            </Rectangle>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsFocused" Value="True"/>
                            <Trigger Property="IsDefaulted" Value="True"/>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Fill" TargetName="rectangle" Value="#FFADADAD"/>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True"/>
                            <Trigger Property="IsEnabled" Value="False"/>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="refreshButton" BasedOn="{x:Null}" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Rectangle Fill="#FFCCCCCC" Stroke="{x:Null}" RadiusX="4.5" RadiusY="4.5" x:Name="rectangle"/>
                            <Path Fill="#FF4F4F4F" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Stretch" Margin="2.543,1.316,6.156,0" VerticalAlignment="Top" Data="M1.3876696,8.7592322 C2.0063235,5.3796074 4.2790603,4.2546091 6.9058285,3.4682785 L6.9058285,1.3121492 11.233508,4.7864166 6.7891272,9.4667957 6.7495597,6.2182432 C4.8433626,5.9056422 3.1316613,6.345166 1.3876696,8.7592322 z" Height="6.877"/>
                            <Path Fill="#FF4F4F4F" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Stretch" Margin="4.628,0,4.071,0.18" VerticalAlignment="Bottom" Data="M1.3876696,8.7592322 C2.0063235,5.3796074 4.2790603,4.2546091 6.9058285,3.4682785 L6.9058285,1.3121492 11.233508,4.7864166 6.7961929,10.022308 6.7495597,6.2182432 C4.8433626,5.9056422 3.1316613,6.345166 1.3876696,8.7592322 z" RenderTransformOrigin="0.5,0.5" Height="7.345">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="180"/>
                                        <TranslateTransform X="0" Y="-1.0649999999999995"/>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsFocused" Value="True"/>
                            <Trigger Property="IsDefaulted" Value="True"/>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Fill" TargetName="rectangle" Value="#FFADADAD"/>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True"/>
                            <Trigger Property="IsEnabled" Value="False"/>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="TreeViewItemFocusVisual">
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Rectangle/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <PathGeometry x:Key="TreeArrow" Figures="M0,0 L0,6 L6,0 z"/>
        <Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
            <Setter Property="Focusable" Value="False"/>
            <Setter Property="Width" Value="16"/>
            <Setter Property="Height" Value="16"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ToggleButton}">
                        <Border Width="16" Height="16" Background="Transparent" Padding="5,5,5,5">
                            <Path Fill="Transparent" Stroke="#FF989898" x:Name="ExpandPath" Data="{StaticResource TreeArrow}">
                                <Path.RenderTransform>
                                    <RotateTransform Angle="135" CenterX="3" CenterY="3"/>
                                </Path.RenderTransform>
                            </Path>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Stroke" TargetName="ExpandPath" Value="#FF1BBBFA"/>
                                <Setter Property="Fill" TargetName="ExpandPath" Value="Transparent"/>
                            </Trigger>
                            <Trigger Property="IsChecked" Value="True">
                                <Setter Property="RenderTransform" TargetName="ExpandPath">
                                    <Setter.Value>
                                        <RotateTransform Angle="180" CenterX="3" CenterY="3"/>
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="Fill" TargetName="ExpandPath" Value="#FF595959"/>
                                <Setter Property="Stroke" TargetName="ExpandPath" Value="#FF262626"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <templateSelectorNs:UniqueIdGenerator x:Key="UniqueIdGenerator"/>
        <templateSelectorNs:VisibilityConverter x:Key="VisibilityConverter"/>
        <templateSelectorNs:VisibilityMultiConverter x:Key="VisibilityMultiConverter"/>
        <templateSelectorNs:PropertyValueTemplateSelector x:Key="PropertyValueTemplateSelector"/>
        <templateSelectorNs:TridentConverter x:Key="TridentConverter"/>
        <templateSelectorNs:WidthConverter x:Key="WidthConverter"/>
        <templateSelectorNs:PropertyTooltipGenerator x:Key="PropertyTooltipGenerator"/>
        <templateSelectorNs:ParameterTemplateSelector x:Key="ParamTemplateSelector"/>
        <BooleanToVisibilityConverter x:Key="boolToVisibility"/>
        <templateSelectorNs:AsterixVisibilityConverter x:Key="AsterixVisibilityConverter"></templateSelectorNs:AsterixVisibilityConverter>
        <templateSelectorNs:ErrorTooltipGenerator x:Key="ErrorTooltipGenerator"></templateSelectorNs:ErrorTooltipGenerator>
        <!--Style for the treeviewitem-->
        <Style TargetType="TreeViewItem">
            <Setter Property="IsExpanded" Value="True"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="Padding" Value="1,0,0,0"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="FocusVisualStyle" Value="{StaticResource TreeViewItemFocusVisual}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TreeViewItem}">
                        <Grid Margin="-5,0,0,0" RequestBringIntoView="TextBox_RequestBringIntoView">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition MinWidth="19" Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <ToggleButton AutomationProperties.AutomationId="{Binding Path=., Converter={StaticResource UniqueIdGenerator}}" x:Name="Expander" Margin="0,3,0,0" VerticalAlignment="Top" Style="{StaticResource ExpandCollapseToggleStyle}" IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"/>
                            <Border Visibility="{Binding Converter={StaticResource VisibilityConverter}, ConverterParameter=ActivityVisibility}" x:Name="Bd" Background="{TemplateBinding Background}" SnapsToDevicePixels="true" Grid.Column="1" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                                <Grid Name="grid">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="16"/>
                                        <ColumnDefinition Width="*" MinWidth="26.098"/>
                                    </Grid.ColumnDefinitions>
                                    <ContentPresenter Margin="2,0,0,0" HorizontalAlignment="Left" x:Name="PART_Header" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" Grid.ColumnSpan="1" Grid.Column="1"/>
                                    <Image Visibility="{Binding Converter={StaticResource VisibilityConverter}, ConverterParameter=ActivityVisibility}"  Margin="0,4,0,0" Grid.ColumnSpan="1" Source="/Microsoft.Research.ScientificWorkflow.TridentUtilities;component/Images/ScientificWorkflow/workflowFolder.png" Width="12" Height="12" HorizontalAlignment="Center" VerticalAlignment="Top" Stretch="UniformToFill"/>
                                </Grid>
                            </Border>
                            <ItemsPresenter x:Name="ItemsHost" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsExpanded" Value="false">
                                <Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
                            </Trigger>
                            <Trigger Property="HasItems" Value="false">
                                <Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
                                <Setter Property="Height" TargetName="Expander" Value="0"/>
                            </Trigger>
                            <Trigger Property="HasItems" Value="true">
                                <Setter Property="Visibility" TargetName="Expander" Value="{Binding Converter={StaticResource VisibilityConverter}, ConverterParameter=ActivityVisibility}"/>
                            </Trigger>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter Property="Foreground" Value="#FF000000"/>
                                <Setter Property="Background" TargetName="grid">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FFA9E2FF" Offset="0"/>
                                            <GradientStop Color="#7FF0FAFF" Offset="1"/>
                                            <GradientStop Color="#FFCAEDFF" Offset="0.129"/>
                                            <GradientStop Color="#FFF0FAFF" Offset="0.205"/>
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsSelected" Value="true"/>
                                    <Condition Property="IsSelectionActive" Value="false"/>
                                </MultiTrigger.Conditions>
                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                                <Setter Property="Background" TargetName="grid">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FFD2D9DD" Offset="0"/>
                                            <GradientStop Color="#7FFFFFFF" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </MultiTrigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!--Default representation of the input values.-->
        <DataTemplate x:Key="parameterLayout" DataType="ParameterDescriptionModel">
            <DockPanel>
                <DockPanel Name="txtBxNonEditableCustomType" LastChildFill="True">
                    <DockPanel.Visibility>
                        <MultiBinding Converter="{StaticResource VisibilityMultiConverter}" ConverterParameter="CustomType">
                            <Binding/>
                            <Binding Path="Value"/>
                        </MultiBinding>
                    </DockPanel.Visibility>
                    <Button Name="btnCustomType" Content="..." DockPanel.Dock="Right" MinWidth="25" Margin="4,0,0,0" Click="OnCustomTypeInitClick" ToolTip="Launch type initializer"/>
                    <Grid DockPanel.Dock="Left">
                        <TextBox Name="txtBxParamValue" Opacity="0.7" IsReadOnly="True" HorizontalAlignment="Stretch" Loaded="OnCustomTypeValLoaded"
                                 TextChanged="OnCustomValueTextChanged" AutomationProperties.AutomationId="{Binding Path=AutomationId}" RequestBringIntoView="TextBox_RequestBringIntoView">
                            <TextBox.Text>
                                <MultiBinding BindingGroupName="textGrpCustomBox" Converter="{StaticResource TridentConverter}" ConverterParameter="CustomTypeTextBox">
                                    <Binding Mode="OneWay"/>
                                    <Binding Mode="OneWay" Path="Value"/>
                                </MultiBinding>
                            </TextBox.Text>
                            <TextBox.ToolTip>
                                <MultiBinding BindingGroupName="tooltipGrpCustomBox" Converter="{StaticResource TridentConverter}" ConverterParameter="CustomTypeTextBox">
                                    <Binding Mode="OneWay"/>
                                    <Binding Mode="OneWay" Path="Value"/>
                                </MultiBinding>
                            </TextBox.ToolTip>
                        </TextBox>
                        <!--Do not change name of the dockpanel, being used via FindName-->
                        <DockPanel Loaded="OnErrorMarkerLoaded" HorizontalAlignment="Left" Margin="-7,-6.4,0,0" Name="errorDckCustomType" Visibility="{Binding Path=IsValueInvalid, Converter={StaticResource boolToVisibility}}" ToolTip="{Binding Converter={StaticResource ErrorTooltipGenerator}}">
                            <Grid DockPanel.Dock="Left" Margin="2,0" Width="12" Height="12">
                                <Ellipse Fill="#FFC42A2A" Stroke="{x:Null}"/>
                                <Path Fill="#FFFFFFFF" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="2" Margin="4.94,2.235,4.644,5.12" Data="M11.701627,8.0009042 L12.372672,15.173164 14.011686,15.241177 14.56827,7.8270056 z"/>
                                <Path Fill="#FFFFFFFF" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="2" Margin="5.121,0,4.779,1.746" VerticalAlignment="Bottom" Height="2.1" Data="M11.395564,17.238573 L14.853121,17.333691 14.771832,21.163108 11.102494,20.999791 z"/>
                            </Grid>
                        </DockPanel>
                    </Grid>
                </DockPanel>
                <Grid Name="txtBxEditable" ToolTip="{Binding Path=Value, Mode=TwoWay}">
                    <Grid.Visibility>
                        <MultiBinding Converter="{StaticResource VisibilityMultiConverter}" ConverterParameter="Editable">
                            <Binding/>
                            <Binding Path="Value"/>
                        </MultiBinding>
                    </Grid.Visibility>
                    <TextBox HorizontalAlignment="Left" Loaded="OnInputValueTextBoxLoaded" LostFocus="OnInputValueTextBoxLostFocus" 
                             TextChanged="OnInputValTextChanged"   
                             Text="{Binding Path=Value, Mode=TwoWay, UpdateSourceTrigger=Explicit}" Foreground="Black"
                             AutomationProperties.AutomationId="{Binding Path=AutomationId}"
                             Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DockPanel}}, Converter={StaticResource WidthConverter}, ConverterParameter=fromTextBox, Path=ActualWidth}" RequestBringIntoView="TextBox_RequestBringIntoView"/>

                    <!--Do not change name of the dockpanel, being used via FindName-->
                    <DockPanel Loaded="OnErrorMarkerLoaded" HorizontalAlignment="Left" Margin="-7,-6.4,0,0" Name="errorDck" Visibility="{Binding Path=IsValueInvalid, Converter={StaticResource boolToVisibility}}" ToolTip="{Binding Converter={StaticResource ErrorTooltipGenerator}}">
                        <Grid DockPanel.Dock="Left" Margin="2,0" Width="12" Height="12">
                            <Ellipse Fill="#FFC42A2A" Stroke="{x:Null}"/>
                            <Path Fill="#FFFFFFFF" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="2" Margin="4.94,2.235,4.644,5.12" Data="M11.701627,8.0009042 L12.372672,15.173164 14.011686,15.241177 14.56827,7.8270056 z"/>
                            <Path Fill="#FFFFFFFF" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="2" Margin="5.121,0,4.779,1.746" VerticalAlignment="Bottom" Height="2.1" Data="M11.395564,17.238573 L14.853121,17.333691 14.771832,21.163108 11.102494,20.999791 z"/>
                        </Grid>
                    </DockPanel>
                </Grid>
                <DockPanel Name="txtBxNonEditable" LastChildFill="False" ToolTip="This input is data bound to another activity's output. Bound values cannot be changed here.">
                    <DockPanel.Visibility>
                        <MultiBinding Converter="{StaticResource VisibilityMultiConverter}" ConverterParameter="NonEditable">
                            <Binding/>
                            <Binding Path="Value"/>
                        </MultiBinding>
                    </DockPanel.Visibility>
                    <TextBox Opacity="0.7" IsReadOnly="True" DockPanel.Dock="Left" HorizontalAlignment="Stretch"                             
                             AutomationProperties.AutomationId="{Binding Path=AutomationId}" RequestBringIntoView="TextBox_RequestBringIntoView">
                        <TextBox.Text>
                            <MultiBinding Converter="{StaticResource TridentConverter}" ConverterParameter="ReadOnlyBoundTextBox">
                                <Binding Mode="OneWay"/>
                                <Binding Mode="OneWay" Path="Value"/>
                            </MultiBinding>
                        </TextBox.Text>
                        <TextBox.ToolTip>
                            <MultiBinding Converter="{StaticResource TridentConverter}" ConverterParameter="ReadOnlyBoundTextBoxTooltip">
                                <Binding Mode="OneWay"/>
                                <Binding Mode="OneWay" Path="Value"/>
                            </MultiBinding>
                        </TextBox.ToolTip>
                    </TextBox>
                </DockPanel>
            </DockPanel>
        </DataTemplate>

        <!--The drop down representing enums-->
        <DataTemplate x:Key="parameterLayoutDropDown" DataType="ParameterDescriptionModel">
            <DockPanel LastChildFill="False">
                <DockPanel>
                    <ComboBox DisplayMemberPath="Value" SelectedValuePath="Key" SelectedIndex="0" Tag="-1" SelectionChanged="OnDropDownSelectionChanged"
                              AutomationProperties.AutomationId="{Binding Path=AutomationId}">
                        <ComboBox.ItemsSource>
                            <MultiBinding  Converter="{StaticResource TridentConverter}" ConverterParameter="comboBoxCtrl">
                                <Binding Mode="OneWay"/>
                            </MultiBinding>
                        </ComboBox.ItemsSource>
                    </ComboBox>
                </DockPanel>
            </DockPanel>
        </DataTemplate>

        <!--Listview header style-->
        <Style x:Key="HeaderStyle" TargetType="GridViewColumnHeader">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                        <DockPanel Focusable="False">
                            <Thumb Focusable="False" x:Name="PART_HeaderGripper" Width="2" Opacity="0.2" DockPanel.Dock="Right" Visibility="Visible" />
                            <Border Focusable="False" CornerRadius="0,0,0,0" TextBlock.TextAlignment="Left" Width="{TemplateBinding Width}" BorderThickness="0,1,0,1">
                                <Border.BorderBrush>
                                    <LinearGradientBrush EndPoint="0.5,1.04" StartPoint="0.5,-0.025">
                                        <GradientStop Color="#FFF0F0F0" Offset="0"/>
                                        <GradientStop Color="#FFD5D5D5" Offset="1"/>
                                    </LinearGradientBrush>
                                </Border.BorderBrush>
                                <Border.Background>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,-0.014">
                                        <GradientStop Color="#FFFEFEFE" Offset="0"/>
                                        <GradientStop Color="#FFF6F7F8" Offset="1"/>
                                        <GradientStop Color="#FFFDFDFD" Offset="0.493"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                                <ContentPresenter Focusable="False" Content="{TemplateBinding Content}" VerticalAlignment="Center" Margin="6,0,0,0" />
                            </Border>
                        </DockPanel>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="Padding" Value="2"/>
            <Setter Property="HorizontalContentAlignment" Value="Left"/>
        </Style>

        <!--Name template with the asterisk being dependent on type.-->
        <DataTemplate x:Key="NameTemplate">
            <Grid Margin="0,3,3,0" DockPanel.Dock="Left" HorizontalAlignment="Left">
                <Grid Margin="0,-0.5,-7,0" Width="8" Height="8" HorizontalAlignment="Right" VerticalAlignment="Top">
                    <Grid.Visibility>
                        <MultiBinding Converter="{StaticResource AsterixVisibilityConverter}">
                            <Binding Path="IsMandatory"/>
                            <Binding Path="IsMandatoryForWorkflow"/>
                        </MultiBinding>
                    </Grid.Visibility>
                        <Path RenderTransformOrigin="0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom" Fill="#FFFF0000" Stretch="Fill" StrokeThickness="0" Data="M18.597656,17.335052 L25.59375,17.335052 L25.382813,29.253021 L36.210938,22.010834 L39.832031,27.424896 L27.667969,34.561615 L39.832031,41.768646 L36.210938,47.112396 L25.242188,39.624115 L25.628906,51.85849 L18.597656,51.85849 L18.808594,39.975677 L8.0859375,47.147552 L4.5,41.73349 L16.59375,34.596771 L4.5703125,27.38974 L8.0859375,21.975677 L18.808594,29.253021 z">
                        <Path.RenderTransform>
                            <TransformGroup>
                                <ScaleTransform ScaleX="0.7" ScaleY="0.7"/>
                                <SkewTransform AngleX="0" AngleY="0"/>
                                <RotateTransform Angle="0"/>
                                <TranslateTransform X="0" Y="0"/>
                            </TransformGroup>
                        </Path.RenderTransform>
                    </Path>
                </Grid>
                <TextBlock Text="{Binding Path=Label}" AutomationProperties.AutomationId="{Binding Path=., Converter={StaticResource UniqueIdGenerator}}"
                       ToolTip="{Binding Converter={StaticResource PropertyTooltipGenerator}, Path=.}" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" HorizontalAlignment="Left"/>
            </Grid>
        </DataTemplate>

        <!--Template for showing all the parameters-->
        <HierarchicalDataTemplate x:Key="ParentActivityTemplate" ItemsSource="{Binding Path=Children}">
            <DockPanel Visibility="{Binding Converter={StaticResource VisibilityConverter}, ConverterParameter=ActivityVisibility}" Margin="1,5,0,0" Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TreeView}}, Converter={StaticResource WidthConverter}, Path=ActualWidth}">
                <TextBlock DockPanel.Dock="Top" HorizontalAlignment="Left" Text="{Binding Path=Label}" FontWeight="SemiBold"/>
                <ListView Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TreeView}}, Path=ActualWidth}"
                    Margin="1,5,0,0" PreviewMouseWheel="OnListViewPreviewMouseWheel" Initialized="OnListViewInitialized" 
                    ItemsSource="{Binding Path=InputParameters}" IsSynchronizedWithCurrentItem="True"
                    ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                          Visibility="{Binding Converter={StaticResource VisibilityConverter}, ConverterParameter=ParamVisibility}">
                    <ListView.View>
                        <GridView ColumnHeaderContainerStyle="{StaticResource HeaderStyle}" AllowsColumnReorder="False">
                            <GridViewColumn Header="Input Parameters" CellTemplate="{StaticResource NameTemplate}" Width="100"/>
                            <GridViewColumn Header="Value" CellTemplateSelector="{StaticResource PropertyValueTemplateSelector}"
                                            Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListView}}, 
                                            Path=ActualWidth}">
                            </GridViewColumn>
                        </GridView>
                    </ListView.View>
                </ListView>
            </DockPanel>
        </HierarchicalDataTemplate>

        <!--Template for showing only the mandatory parameters-->
        <HierarchicalDataTemplate x:Key="ParentActivityTemplateMandatory" ItemsSource="{Binding Path=Children}">
            <DockPanel Visibility="{Binding Converter={StaticResource VisibilityConverter}, ConverterParameter=ActivityVisibility}" Margin="1,5,0,0" Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TreeView}}, Converter={StaticResource WidthConverter}, Path=ActualWidth}">
                <TextBlock DockPanel.Dock="Top" HorizontalAlignment="Left" Text="{Binding Path=Label}" FontWeight="SemiBold"/>
                <ListView Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TreeView}}, Path=ActualWidth}"
                    Margin="1,5,0,0" PreviewMouseWheel="OnListViewPreviewMouseWheel" Initialized="OnListViewInitialized" 
                    ItemsSource="{Binding Path=MandatoryAndWrongInputParameters}" IsSynchronizedWithCurrentItem="True"
                    ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
                          Visibility="{Binding Converter={StaticResource VisibilityConverter}, ConverterParameter=ParamVisibility}">
                    <ListView.View>
                        <GridView ColumnHeaderContainerStyle="{StaticResource HeaderStyle}" AllowsColumnReorder="False">
                            <GridViewColumn Header="Input Parameters" CellTemplate="{StaticResource NameTemplate}" Width="100"/>
                            <GridViewColumn Header="Value" CellTemplateSelector="{StaticResource PropertyValueTemplateSelector}"
                                            Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListView}}, 
                                            Path=ActualWidth}">
                            </GridViewColumn>
                        </GridView>
                    </ListView.View>
                </ListView>
            </DockPanel>
        </HierarchicalDataTemplate>

        <!--Template for showing only the mandatory parameters-->
        <HierarchicalDataTemplate x:Key="ParentActivityTemplateWrong" ItemsSource="{Binding Path=Children}">
            <DockPanel Visibility="{Binding Converter={StaticResource VisibilityConverter}, ConverterParameter=ActivityVisibility}" Margin="1,5,0,0" 
                       Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TreeView}}, Converter={StaticResource WidthConverter}, Path=ActualWidth}">
                <TextBlock DockPanel.Dock="Top" HorizontalAlignment="Left" Text="{Binding Path=Label}" FontWeight="SemiBold"/>
                <ListView Name="lstVw" Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TreeView}}, Path=ActualWidth}"
                    Margin="1,5,0,0" PreviewMouseWheel="OnListViewPreviewMouseWheel" Initialized="OnListViewInitialized" 
                    ItemsSource="{Binding Path=WrongInputs}" IsSynchronizedWithCurrentItem="True"
                    ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
                          Visibility="{Binding Converter={StaticResource VisibilityConverter}, ConverterParameter=ParamVisibility}">
                    <ListView.View>
                        <GridView ColumnHeaderContainerStyle="{StaticResource HeaderStyle}" AllowsColumnReorder="False">
                            <GridViewColumn Header="Input Parameters" CellTemplate="{StaticResource NameTemplate}" Width="100"/>
                            <GridViewColumn Header="Value" CellTemplateSelector="{StaticResource PropertyValueTemplateSelector}"
                                            Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListView}}, 
                                            Path=ActualWidth}">
                            </GridViewColumn>
                        </GridView>
                    </ListView.View>
                </ListView>
            </DockPanel>
        </HierarchicalDataTemplate>

    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">
        <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderBrush="#FFBDBDBD" BorderThickness="1,1,2,2" CornerRadius="4,4,4,4">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFF7F7F7" Offset="0"/>
                    <GradientStop Color="#FFF1F1F1" Offset="1"/>
                </LinearGradientBrush>
            </Border.Background>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="28"/>
                    <RowDefinition Name="rowMainHolder" Height="*"/>
                </Grid.RowDefinitions>
                <Border MouseLeftButtonDown="OnHeaderMouseDown" Name="brdrHeader" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Grid.Row="0" CornerRadius="4,4,0,0">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FFF7F7F7" Offset="0"/>
                            <GradientStop Color="#FFE9E9E9" Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <Grid>
                        <TextBlock HorizontalAlignment="Left" Margin="5,0,0,0" VerticalAlignment="Center" FontSize="14" Foreground="#FF5F5F5F" Name="txtBlkPropPaneHeader" TextWrapping="Wrap"/>
                        <DockPanel HorizontalAlignment="Right" Margin="0,5.5,5,5.5" LastChildFill="False">
                            <Button Name="btnPropPaneRefresh" ToolTip="Refresh" DockPanel.Dock="Left" Margin="0,0,5,0" Click="OnPropertyPaneRefreshClick" Style="{DynamicResource refreshButton}" Width="17" Content="Refresh"/>
                            <Button Name="btnPropPaneClose" ToolTip="Close" DockPanel.Dock="Left" Click="OnPropPaneCloseClick" HorizontalAlignment="Right" Style="{DynamicResource PopupCloseButton}" Width="17" Content="Button"/>
                        </DockPanel>
                    </Grid>
                </Border>
                <DockPanel LastChildFill="True" HorizontalAlignment="Stretch" Margin="10,10,0,10" Grid.Row="1">
                    <DockPanel Name="dckWfDetails" Visibility="Collapsed" DockPanel.Dock="Top">
                        <DockPanel Name="dckWfName" LastChildFill="True" DockPanel.Dock="Top">
                            <TextBlock DockPanel.Dock="Left" Text="Name:" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis"/>
                            <Grid DockPanel.Dock="Left" Margin="36,0,5,5">
                                <TextBox Name="txtBxWfName" MaxLength="75" TextChanged="OnValueTextChanged" LostFocus="OnWfNameTextBoxLostFocus" TextWrapping="NoWrap"/>
                                <DockPanel HorizontalAlignment="Left" Margin="-7,-6.4,0,0" Name="errorWfName" Visibility="Visible">
                                    <Grid DockPanel.Dock="Left" Margin="2,0" Width="12" Height="12">
                                        <Ellipse Fill="#FFC42A2A" Stroke="{x:Null}"/>
                                        <Path Fill="#FFFFFFFF" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="2" Margin="4.94,2.235,4.644,5.12" Data="M11.701627,8.0009042 L12.372672,15.173164 14.011686,15.241177 14.56827,7.8270056 z"/>
                                        <Path Fill="#FFFFFFFF" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="2" Margin="5.121,0,4.779,1.746" VerticalAlignment="Bottom" Height="2.1" Data="M11.395564,17.238573 L14.853121,17.333691 14.771832,21.163108 11.102494,20.999791 z"/>
                                    </Grid>
                                </DockPanel>
                            </Grid>
                        </DockPanel>
                        <DockPanel Name="dckWfDesc" LastChildFill="True" DockPanel.Dock="Top">
                            <TextBlock DockPanel.Dock="Left" Text="Description:" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis"/>
                            <TextBox Name="txtBxWfDesc" LostFocus="OnWfDescTextBoxLostFocus" MaxLength="300" DockPanel.Dock="Left" TextWrapping="NoWrap" Margin="7,0,5,5"/>
                        </DockPanel>

                        <DockPanel Name="dckWfType" LastChildFill="True" DockPanel.Dock="Top">
                            <TextBlock DockPanel.Dock="Left" Text="Type:" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis"/>
                            <ComboBox Name="cmbWorkflowType" AutomationProperties.AutomationId="AIdWorkflowType"  Margin="43,0,5,5" DockPanel.Dock="Right" SelectionChanged="OnWorkflowTypeChanged">
                                <ComboBoxItem Content="Interactive" AutomationProperties.AutomationId="AIdInteractiveItem"/>
                                <ComboBoxItem Content="Non Interactive" AutomationProperties.AutomationId="AIdNonInteractiveItem"/>
                            </ComboBox>
                        </DockPanel>
                        
                        <DockPanel Name="dckCategory" LastChildFill="True" DockPanel.Dock="Top">
                            <TextBlock DockPanel.Dock="Left" Text="Category:" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis"/>
                            <TextBlock Name="txtBlkEditWfCategory" Focusable="True" PreviewKeyDown="OnEditCategoryKeyDown" KeyboardNavigation.IsTabStop="True" DockPanel.Dock="Right" Margin="0,3,5,0" Cursor="Hand" Text="Edit" Foreground="Blue" TextDecorations="Underline" PreviewMouseLeftButtonUp="OnEditWorkflowCategory"/>
                            <Grid DockPanel.Dock="Left" Margin="18,0,5,5">
                                <TextBox Name="txtBxWfCategory" IsTabStop="False" KeyboardNavigation.IsTabStop="False" ToolTip="The category of the workflow needs to be specified." ToolTipService.ShowOnDisabled="True" IsReadOnly="True" Opacity="0.7" TextWrapping="NoWrap"/>
                                <DockPanel ToolTip="The category of the workflow needs to be specified." HorizontalAlignment="Left" Margin="-6,-5.9,0,0" Name="errorWfCategory" Visibility="Visible">
                                    <Grid DockPanel.Dock="Left" Margin="2,0" Width="12" Height="12">
                                        <Ellipse Fill="#FFC42A2A" Stroke="{x:Null}"/>
                                        <Path Fill="#FFFFFFFF" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="2" Margin="4.94,2.235,4.644,5.12" Data="M11.701627,8.0009042 L12.372672,15.173164 14.011686,15.241177 14.56827,7.8270056 z"/>
                                        <Path Fill="#FFFFFFFF" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="2" Margin="5.121,0,4.779,1.746" VerticalAlignment="Bottom" Height="2.1" Data="M11.395564,17.238573 L14.853121,17.333691 14.771832,21.163108 11.102494,20.999791 z"/>
                                    </Grid>
                                </DockPanel>
                            </Grid>
                        </DockPanel>
                    </DockPanel>
                    <Separator Name="sprtr" Visibility="Collapsed" Margin="0,2,5,3" DockPanel.Dock="Top"/>
                    <DockPanel DockPanel.Dock="Top">
                        <Image Name="imgWarningIcon" Source="/Microsoft.Research.ScientificWorkflow.TridentUtilities;component/Images/ScientificWorkflow/WarningIcon.png" 
                               Margin="5,0,0,0" Width="14" Height="14" DockPanel.Dock="Left" Visibility="Collapsed"/>
                        <TextBlock Name="txtMandatoryParams" Visibility="Collapsed" Text="Incorrect mandatory inputs might affect execution." 
                               ToolTip="Incorrect inputs might affect execution" DockPanel.Dock="Left"
                               FontStyle="Italic" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" Margin="3,0,0,0"/>
                    </DockPanel>
                    <StackPanel DockPanel.Dock="Bottom" VerticalAlignment="Bottom">
                        <TextBlock x:Name="txtBlkWarningText" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" Foreground="Red"
                                   Text="Please enter valid values." ToolTip="Please enter valid values."
                                   Visibility="Collapsed" HorizontalAlignment="Left"/>
                        <DockPanel LastChildFill="False" HorizontalAlignment="Right">
                            <Button IsDefault="True" Name="btnOk" TabIndex="2" Visibility="Collapsed" Content="OK" Width="50" Click="OnOkClick" HorizontalAlignment="Right" Margin="0,3,5,1" DockPanel.Dock="Left"/>
                            <Button IsCancel="True" Name="btnCancel" TabIndex="3" Visibility="Collapsed" Content="Cancel" Width="50" Click="OnCancelClick" HorizontalAlignment="Right" Margin="0,3,5,1" DockPanel.Dock="Left"/>
                        </DockPanel>
                    </StackPanel>

                    <Border Name="brdrTreeVeHolder" KeyboardNavigation.IsTabStop="False" DockPanel.Dock="Top" HorizontalAlignment="Stretch" Margin="0,5,5,3" VerticalAlignment="Stretch" Background="#FFFFFFFF" BorderBrush="#FFC2C2C2" BorderThickness="1,1,1,1" CornerRadius="2,2,2,2" Padding="5,5,5,5">
                        <Grid>
                            <TabControl TabIndex="1" Style="{DynamicResource Centerpanetab}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" x:Name="propertyTreeHostTab">
                                <TabControl.Items>
                                    <TabItem Width="120" Header="Activity Parameters" Style="{DynamicResource CaenterPaneTabItemStyle}">
                                        <Border x:Name="propertyTreeHost"></Border>
                                        
                                    </TabItem>
                                    <TabItem Width="130" Header="Workflow Parameters" Style="{DynamicResource CaenterPaneTabItemStyle}">
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition/>
                                                <RowDefinition/>
                                            </Grid.RowDefinitions>
                                            <Border Grid.Row="0" x:Name="propertyListHost"></Border>
                                            <Border Grid.Row="1" x:Name="workflowOutputListHost"></Border>
                                        </Grid>
                                    </TabItem>
                                </TabControl.Items>
                            </TabControl>
                            <Border x:Name="propertyTreeHostBorder">
                                
                            </Border>
                        </Grid>
                    </Border>
                </DockPanel>
            </Grid>
        </Border>
    </Grid>
</UserControl>